import socket


def main():
    address = "192.168.199.142"
    port = 8080
    while True:
        send_data = input("请输入:")
        if send_data == "":
            break
        # 创建一个UDP套接字
        udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        # 可以使用套接字收发数据
        udp_socket.sendto(send_data.encode("utf-8"), (address, port))
    # 关闭套接字
    udp_socket.close()


if __name__ == '__main__':
        main()
